package com.example.shop.goods.dto;

import com.example.shop.goods.enums.EvaluationType;
import com.example.shop.pojo.Evaluation;
import com.example.shop.pojo.EvaluationPicture;
import com.example.shop.user.dto.UserBriefInfo;
import com.fasterxml.uuid.Generators;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class EvaluationInfoParam extends EvaluationBase{
    @NotNull
    private Long orderId;
    private EvaluationType evaluationType = EvaluationType.FAVORABLE;
    @Size(min = 0,max = 5)
    private List<MultipartFile> evaluationPictureList;
    private MultipartFile evaluationVideo;

    public Evaluation toEvaluation(){
        Evaluation evaluation = new Evaluation();
        //回复评论id: 根据时间生成UUID
        evaluation.setEvaluationId(Generators.timeBasedGenerator().generate().node());
        evaluation.setOrderId(orderId);
        evaluation.setEvaluationType(evaluationType.name());
        evaluation.setEvaluationContent(content);
        evaluation.setEvaluationDate(LocalDate.now());
        return evaluation;
    }

}
